package org.kzwl.book.controller.web;

import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.kzwl.comm.pojo.ResponseData;
import org.kzwl.comm.pojo.bo.QueryAdminWebCommentsBO;
import org.kzwl.comm.pojo.bo.QueryWebCommentsBO;
import org.kzwl.comm.pojo.bo.SaveCuWebCommentsBO;
import org.kzwl.comm.pojo.bo.UpdateWebCommentsBO;
import org.kzwl.entity.web.CuWebComments;
import org.kzwl.service.web.CuWebCommentsService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
* @Author:maomao
* @Description: web评论
* @Date: 2021/3/6 5:46 下午
*/
@Api( "风采展示评论")
@RestController
@RequestMapping("/CuWebComments")
public class CuWebCommentsController {

    @Resource
    CuWebCommentsService cuWebCommentsService;

    /**
    * @Author:maomao
    * @Description: 添加评论
    * @Date: 2021/3/6 5:48 下午
    */
    @PostMapping("/saveComments")
    public ResponseData<Void> saveComments(@RequestBody @Valid SaveCuWebCommentsBO saveCuWebCommentsBO)
    {
        return cuWebCommentsService.saveComments(saveCuWebCommentsBO);
    }

    /**
    * @Author:maomao
    * @Description: 查询评论
    * @Date: 2021/3/6 6:09 下午
    */
    @ApiOperation(value = "查询评论")
    @PostMapping("/queryComments")
    public ResponseData<IPage<CuWebComments>> queryComments(@RequestBody QueryWebCommentsBO queryWebCommentsBO)
    {
        return cuWebCommentsService.queryComments(queryWebCommentsBO);
    }

    @ApiOperation(value = "后台查询审核信息")
    @PostMapping("/queryAdminComments")
    public ResponseData<IPage<CuWebComments>> queryAdminComments(@RequestBody QueryAdminWebCommentsBO queryAdminWebCommentsBO)
    {
        return cuWebCommentsService.queryAdminComments(queryAdminWebCommentsBO);
    }
    @ApiOperation(value = "审核评论")
    @PostMapping("/updateAdminComments")
    public ResponseData<Void> updateAdminComments(@RequestBody UpdateWebCommentsBO updateWebCommentsBO)
    {
        return cuWebCommentsService.updateAdminComments(updateWebCommentsBO);
    }

}
